<table class="types">
    <tr>
        <td class="active" type="he">总和数</td>
        <td type="daxiao">总和大小</td>
        <td type="danshuang">总和单双</td>
    </tr>
</table>
<div class="s-container">
    <table class="list">
        <tr>
        </tr>
    </table>
</div>
<style type="text/css">
    table.types td { width: 33%; }
</style>

<script>
    var list = [];
    $(".types td").click(function(e) {
        var th = $(e.currentTarget);
        if (th.attr("class") && th.attr("class").indexOf("active") != -1) return;
        $(".types td").removeClass("active");
        th.addClass("active");

        updateLuZhu();
        _hscroll1.refresh();
        _hscroll1.scrollTo($(".s-container").width() - $(_hscroll1.scroller).width(), 0);
    });

    startSpin();
    var data = {
        pageNum: 1,
        pageSize: 200,
        type: context.center.game,
    };
    CMD.lottery_query(data, function(r) {
        stopSpin();
        list = r.list;
        updateLuZhu();
        _hscroll1.refresh();
        _hscroll1.scrollTo($(".s-container").width() - $(_hscroll1.scroller).width(), 0);
    });

    function updateLuZhu()
    {
        if (Util.isEmpty(list)) return;
        var type = $(".types .active").attr("type");
        var m = kl8Rule.prototype.luzhu(list, 0, type);
        if (!m) return;
        m.reverse();

        var tr = $(".list tr");
        tr.empty();
        for (var i = 0; i < 25; i++) {
            var index = i;
            if (m.length < 25) {
                index = i + (m.length - 25);
            }
            if (index < 0) tr.append("<td> </td>");
            else {
                var c = "";
                for (var j = 0 ; j < m[index].c; j++) {
                    if (j == 0) c = c + m[index].n;
                    else c += "<br/>" + m[index].n;
                }
                tr.append("<td>" + c + "</td>");
            }
        }
    }

    var _hscroll1;
    $(function() {
        _hscroll1 = new IScroll(".s-container", {
            scrollX: true,
            scrollY: false,
            click: true,
        })
    });
</script>